import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { User } from '../users/users.entity';

@Entity('matches')
export class Match {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'user_id' })
  userId: number;

  @Column({ name: 'matched_user_id' })
  matchedUserId: number;

  @Column({ name: 'match_type', default: 'algorithm' })
  matchType: string;

  @Column({ default: 'active' })
  status: string;

  @CreateDateColumn({ name: 'matched_at' })
  matchedAt: Date;

  @ManyToOne(() => User)
  @JoinColumn({ name: 'user_id' })
  user: User;

  @ManyToOne(() => User)
  @JoinColumn({ name: 'matched_user_id' })
  matchedUser: User;
}
